Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(search): summarize insight when missing name #18809

Merged
merged 8 commits into from
Nov 22, 2023
Merged

Conversation

thmsobrmlr
Copy link
Contributor

Problem

Insights without a name show up empty in production.

Changes

This PR uses the summarizeInsight function instead of derived_name to display an alternative display name for insights.

How did you test this code?

Tested locally

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

github-actions bot commented Nov 22, 2023

Size Change: 0 B

Total Size: 1.97 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.97 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@thmsobrmlr thmsobrmlr requested a review from a team November 22, 2023 10:55
# Conflicts:
#	frontend/__snapshots__/components-command-bar--search.png
@thmsobrmlr thmsobrmlr enabled auto-merge (squash) November 22, 2023 12:02
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@thmsobrmlr thmsobrmlr merged commit f1427f5 into master Nov 22, 2023
74 checks passed
@thmsobrmlr thmsobrmlr deleted the search-insight-name branch November 22, 2023 12:26
Comment on lines +101 to +111
return extra_fields.name ? (
<span>{extra_fields.name}</span>
) : (
<i>
{summarizeInsight(extra_fields.query as Node | null, extra_fields.filters as Partial<FilterType>, {
aggregationLabel,
cohortsById,
mathDefinitions,
})}
</i>
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem right, because there shouldn't be insights that have neither name nor derived_name. Facilitating searchability is a major reason for derived_name being saved, so we shouldn't paper over this. Should we revert this and fix the root cause, or am I missing something here? @thmsobrmlr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I've reimplemented what we do for saved insights as derived_name isn't set for insights in production. Happy to look into it, but would appreciate pointers on how/where we set it. And wouldn't revert this change for now, as we do the same thing in other places and it works for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Digging a bit it seems that we've at one point set the derived_name frontend side when saving an insight, but don't do so now. We obviously can't get the names back this way (and this wouldn't work for insights generated via API), so I'll probably have to duplicate the javascript function in python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants